package com.syedu.day08.homework;

/**
 * @Description 员工工厂
 * @createTime 2022/3/18 13:45
 * @author Administrator
 */
public class EmployeeFactory {
    public static final int SALARIED_EMPLOYEE = 1;
    public static final int HOURLY_EMPLOYEE = 2;
    public static final int SALES_EMPLOYEE = 3;
    public static final int BASED_PLUS_SALES_EMPLOYEE = 4;

    public static Employee getEmployee(int type){
        Employee employee = null;
        switch (type){
            case SALARIED_EMPLOYEE:
                employee = new SalariedEmployee();
                break;
            case HOURLY_EMPLOYEE:
                employee = new HourlyEmployee();
                break;
            case SALES_EMPLOYEE:
                employee = new SalesEmployee();
                break;
            case BASED_PLUS_SALES_EMPLOYEE:
                employee = new BasedPlusSalesEmployee();
                break;
            default:
                System.out.println("参数不合法...");
        }
        return employee;
    }
}
